﻿using System;
using System.IO;
using System.Linq;
using System.Text;
using LinqToStreams;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace linqstreams_tests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void Test1()
        {
            string text = "BlahTestBlah";
            var m = new MemoryStream(Encoding.UTF8.GetBytes(text));
            var r1 = m.DeferredRead();
            Assert.IsTrue(Enumerable.SequenceEqual(m.ToArray(), Encoding.UTF8.GetBytes(text)));
            var r = new string(r1.Decode(Encoding.UTF8).ToArray());
            Console.WriteLine(r);
            Assert.AreEqual(text, r, "Strings not the same");
        }
    }
}
